package com.team.appinfo.service.impl;

import com.team.appinfo.entity.BackendUser;
import com.team.appinfo.entity.BackendUserExample;
import com.team.appinfo.mapper.BackendUserMapper;
import com.team.appinfo.service.BackendUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BackendUserServiceImpl implements BackendUserService {

    @Autowired
    private BackendUserMapper backendUserMapper;

    @Override
    public BackendUser dologin(String uresname, String password) {
        BackendUserExample bue=new BackendUserExample();
        BackendUserExample.Criteria criteria = bue.createCriteria();
        criteria.andUsercodeEqualTo(uresname);
        criteria.andUserpasswordEqualTo(password);
        List<BackendUser> list = this.backendUserMapper.selectByExample(bue);
        if (list!=null&&list.size()==1){
            return list.get(0);
        }
        return null;
    }
}
